package org.shj.thread.book2.chapter12.active;


class SchedulerThread extends Thread{

	private final ActivationQueue queue;
	
	public SchedulerThread(ActivationQueue queue){
		this.queue = queue;
	}
	
	public void invoke(MethodRequest request){
		queue.putRequest(request);
	}
	
	public void run(){
		while(true){
			MethodRequest req = queue.takeRequest();
			req.execute();
		}
	}
}
